import { Injectable, Logger } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm';
import { Repository } from 'typeorm';
import { ConfigService } from '@nestjs/config';
import { BaseService } from '@wwjCommon/base/base.service';
import { CacheService } from '@wwjCommon/cache/cache.service';
import { LoggingService } from '@wwjCommon/logging/logging.service';
import { UploadService } from '@wwjVendor/upload/upload.service';
import { PayService } from '@wwjVendor/pay/pay.service';
import { SmsService } from '@wwjVendor/sms/sms.service';
import { NoticeService } from '@wwjVendor/notice/notice.service';

@Injectable()
export class OplatformConfigService extends BaseService<any> {
  private readonly logger = new Logger(OplatformConfigService.name);

  constructor(
    @InjectRepository(Object)
    protected readonly repository: Repository<any>,
    private readonly cacheService: CacheService,
    private readonly configService: ConfigService,
    private readonly loggingService: LoggingService,
    private readonly uploadService: UploadService,
    private readonly payService: PayService,
    private readonly smsService: SmsService,
    private readonly noticeService: NoticeService,
  ) {
    super(repository);
  }

  /**
   * getConfig
   * 对应 PHP: OplatformConfigService_admin::getConfig()
   * 逻辑类型: undefined - undefined
   */
  async getConfig() {
    // 基于PHP真实逻辑: getConfig
    // PHP原文: $config =  (new CoreOplatformConfigService())->getConfig();         foreach ($config as $k => $v) {             if ($v !== '' && in_array($k, ['app_se...
const config =  this.coreOplatformConfigService.getConfig(];
        foreach (config as k => v) {
            if (v !== '' && in_[k, ['app_secret', 'aes_key'))) {
                config[k] = CommonDict.ENCRYPT_STR;
            }
  }

  /**
   * setConfig
   * 对应 PHP: OplatformConfigService_admin::setConfig()
   * 逻辑类型: undefined - undefined
   */
  async setConfig(data: any[]) {
    // 基于PHP真实逻辑: setConfig
    // PHP原文: $config =  (new CoreOplatformConfigService())->getConfig();         foreach ($data as $k => $v) {             if ($v == CommonDict::ENCRYPT_STR) {    ...
const config =  this.coreOplatformConfigService.getConfig(];
        foreach (data as k => v) {
            if (v == CommonDict.ENCRYPT_STR) {
                data[k] = config[k];
            }
  }

  /**
   * getStaticInfo
   * 对应 PHP: OplatformConfigService_admin::getStaticInfo()
   * 逻辑类型: undefined - undefined
   */
  async getStaticInfo() {
    // 基于PHP真实逻辑: getStaticInfo
    // PHP原文: return (new CoreOplatformConfigService())->getStaticInfo();     } }...
return this.coreOplatformConfigService.getStaticInfo(];
    }
}
  }
}
